/*
 通过mutation间接更新state的多个方法的对象
 */
import {RECEIVE_ADDRESS, RECEIVE_USER_INFO,} from './mutation-types'

export default {
  // 异步获取地址
  async getAddress({commit, state}) {
    const result = await setTimeout(() => ({data: '异步获取数据', code: '0'}), 1000);
    commit(RECEIVE_ADDRESS, {data: result.data})
  },
  // 同步记录用户信息
  recordUserInfo({commit}, userInfo) {
    commit(RECEIVE_USER_INFO, {userInfo})
  },
}
